<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台广告管理</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/Public/Admin/css/bootstrap.min14ed.css" rel="stylesheet">
    <link href="/Public/Admin/css/font-awesome.min93e3.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/Admin/css/animate.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/style.min862f.css" rel="stylesheet">
    <link href="/Public/Admin/js/plugins/layer/skin/layer.css" rel="stylesheet">
    <link href="/Public/Admin/js/plugins/layer/laypage/skin/laypage.css" rel="stylesheet">
    <style type="text/css">
        #show img{
            border-radius: 10%;
            width: 110px;
            height: 80px;
            vertical-align: middle;
        }
    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>广告管理</h5>
                    <div class="ibox-tools">
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="row m-b-sm m-t-sm">
                        <form name="form1" id="form1" method="get" action="<?php echo U('ad/index');?>">
                        <div class="col-md-2">
                            <a href="<?php echo U('ad/add');?>" class="btn btn-outline btn-primary">添加广告</a>
                        </div>
                        </form>
                    </div>

                    <table class="table table-bordered">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>排序</th>
                            <th>广告标题</th>
                            <th>广告图片</th>
                            <th>广告类型</th>
                            <th>所属版位</th>
                            <th>点击数</th>
                            <th>添加时间</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody id="show">
                            <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
                                    <td><?php echo ($vo["id"]); ?></td>
                                    <td><?php echo ($vo["sort"]); ?></td>
                                    <td><?php echo ($vo["title"]); ?></td>
                                    <td>
                                        <?php if($vo['imgs'] == ''): ?><img src="/Public/Admin/img/profile_small.jpg"/>
                                        <?php else: ?>
                                            <img src="/<?php echo ($vo["imgs"]); ?>"/><?php endif; ?>
                                    </td>
                                    <td><?php echo ($vo["type"]); ?></td>
                                    <td><?php echo ($vo["position"]); ?></td>
                                    <td><?php echo ($vo["hits"]); ?></td>
                                    <td><?php echo ($vo["addtime"]); ?></td>
                                    <td>
                                        <?php if(($vo["status"] == 1)): ?><a href="javascript:changeState(<?php echo ($vo["id"]); ?>)" id="state<?php echo ($vo["id"]); ?>" class="btn btn-primary dim">正常</a>
                                            <?php else: ?>
                                            <a href="javascript:changeState(<?php echo ($vo["id"]); ?>)" id="state<?php echo ($vo["id"]); ?>" class="btn btn-danger dim">禁用</a><?php endif; ?>
                                    </td>
                                    <td>
                                        <a href="<?php echo U('Admin/ad/edit?id='.$vo['id']);?>" class="btn btn-outline btn-primary"><i class="fa fa-edit"></i>&nbsp;修改</a>&nbsp;&nbsp;
                                        <a href="javascript:delData(<?php echo ($vo["id"]); ?>)" class="btn btn-outline btn-danger"><i class="fa fa-trash"></i>&nbsp;删除</a></td>
                                </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/Public/Admin/js/jquery.min.js"></script>
<script src="/Public/Admin/js/bootstrap.min.js"></script>
<script src="/Public/Admin/js/plugins/layer/layer.min.js"></script>
<script src="/Public/Admin/js/common.js"></script>
<script src="/Public/Admin/js/plugins/layer/laypage/laypage.js"></script>
<script>
function delData(id){
    common.del("<?php echo U("ad/del");?>",id,"<?php echo U("ad/index");?>");
}
function changeState(id){
    var idstr = '#state'+id;
    var objectState = $(idstr);
    common.status("<?php echo U('ad/changeState');?>",id,objectState);
}

</script>
</html>